package utils;

import java.util.*;

/**
 * 功能描述:
 *
 * @author liping(lpaidd50@gmail.com)
 * @version v1.0
 * @date 2016/8/8
 */
public class Signature {
	/**
	 *
	 */
	public static String getSign(Map<String, String> content, String keyValue) {
		List<String> keys = new ArrayList<String>();
		for (Map.Entry<String, String> set : content.entrySet()) {
			keys.add(set.getKey());
		}
		Arrays.sort(keys.toArray());
		String url = "";
		for (String key : keys) {
			url += key + "=" + content.get(key) + "&";
		}
		url = url.substring(0, url.length() - 1);
		url = url + "&key=" + keyValue;
		String sign = MD5.MD5Encode(url).toUpperCase();
		return sign;
	}
}
